<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>注册-虎居农产品.餐饮.本地生活外卖极速达</title>
    <link th:href="@{/css/iconfont.css}" rel="stylesheet" 0="app\assets\AppAsset">
    <link th:href="@{/css/site-base.css}" rel="stylesheet" 0="app\assets\AppAsset">
    <link th:href="@{/css/main.css}" rel="stylesheet" 0="app\assets\AppAsset">
    <link rel="shortcut icon" th:href="@{/shop_pc/images/favicon.ico}">
    <script language="JavaScript" th:src="@{/js/jquery-1.10.2.min.js}"></script>
    <script language="JavaScript" th:src="@{js/jquery.cookie.js}"></script>
    <script language="JavaScript" th:src="@{/js/superslide.js}"></script>
    <script language="JavaScript" th:src="@{/js/main.js}"></script>
    <script language="JavaScript" th:src="@{/js/layer.js}"></script>
    <script type="text/javascript" th:src="@{/js/function.js}"></script>
</head>
<body>
<!--header-->
<div class="login-header">
    <div class="w1190">
        <div class="logo">
            <a title="外卖新鲜极速送—上虎居网上商城" href="/">
                <img alt="外卖新鲜极速送—上虎居网上商城" th:src="@{/picture/logo.png}">
            </a>
            <h2 title="购买新鲜—上虎居网上商城直卖网">用户注册-虎居农产品.餐饮.本地生活外卖极速达</h2>
        </div>
        <a title="外卖新鲜极速送—上虎居网上商城" class="fr" th:href="@{/index/index}">
            商城首页
        </a>
    </div>
</div>

<div class="registerBox">
    <div class="register-main">
        <div class="registerL">
            <form id="RegForm" method="post" th:action="@{/user/reg}">
                <span style="color: red;font-size: 18px;margin-left: 180px;" th:text="${error}"></span>
            <ul>
                <li>
                    <label>
                        用户名
                    </label>
                    <input class="yzm-ipt" type="text" maxlength="11" id="name" name="name" placeholder="请输入用户名" />
                    <span class="tips"></span>
                </li>
                <li>
                    <label>
                        地址
                    </label>
                    <input class="yzm-ipt" type="text" maxlength="11" id="address" name="address" placeholder="请输入地址" />
                    <span class="tips"></span>
                </li>
                <li>
                    <label>
                        设置密码
                    </label>
                    <input type="password" placeholder="建议至少使用两种字符组合" id="password"  name="password"/>
                    <span class="tips"></span>
                </li>
                <li>
                    <label>
                        密码确认
                    </label>
                    <input type="password" placeholder="请再次输入密码" id="password_queren" />
                    <span class="tips"></span>
                </li>
            </ul>
            <button type="submit" id="RegisterSubmit" class="reg-btn">
                同意协议并注册
            </button>
            </form>
        </div>
        <div class="loginR">
            <p>已有虎居账号，点击立即登录</p>
            <a class="log" title="登录" th:href="@{/user/tologin}">登录</a>
        </div>
    </div>
</div>
<script language="JavaScript">
    var registerSubmitOBJ = $('#RegisterSubmit');
    var mobileObj = $('#name');
    var passwordObj = $('#password');
    var querenObj = $('#password_queren');

    var name = mobileObj.val();
    var pas = passwordObj.val();
    var pas2 = querenObj.val();
    $('.yzm').click();

    $(function(){
        $(".yzm").find("img").click();
        // 手机号验证
        mobileObj.blur(function() {
            clerBoxMsg(mobileObj);
            var val = $(this).val();
            if($.trim(val)==''){
                registerBoxMsg(mobileObj,'请输入用户名');
            }
        });

        // 密码验证
        passwordObj.blur(function() {
            clerBoxMsg(passwordObj);
            var val = $(this).val();
            if($.trim(val)==''){
                registerBoxMsg(passwordObj,'请输入密码');
            }else if(val.length<6){
                registerBoxMsg(passwordObj,'密码不能少于 6 个字符');
            }
        });

        // 确认密码
        querenObj.blur(function() {
            clerBoxMsg(querenObj);
            var val = $(this).val();
            var pwd = $('#password').val();
            if($.trim(val)==''){
                registerBoxMsg(querenObj,'请确认密码');
            }else if($.trim(pwd)!= $.trim(val)){
                registerBoxMsg(querenObj,'两次密码不一致');
            }
        });

        var isReg=false;
        $('#RegisterSubmit').click(function(){
            var _this = $(this);
            if(!isReg) {
                isReg = true;

                name = $('#mobile').val();
               //code = $('#code').val();
               // smscode = $('#smscode').val();
                pas = $('#password').val();
                pas2 = $('#password_queren').val();

                //提交处理
                var check = checkRegister(name, pas, pas2, mobileObj, passwordObj, querenObj);
                if (check) {
                    $.ajax({
                        url: '/reg.html',
                        type: 'post',
                        data: {
                            name: uphone,
                            pas: pas,
                            spreadCode: '',
                            genType: '',
                            _csrf: '1Gh1t7tkvME6Pwf2VAoePBqs9xE45nVpSHrQzu6pK3CYIRHE4yCMp2hUUrcFRXFMa52gTl21Ei8iLoaNoN1CIQ=='
                        },
                        dataType: 'json',
                        beforeSend: function(ret) {
                            _this.css({'pointer-events': 'none'});
                        },
                        complete: function(ret) {
                            _this.css({'pointer-events': 'auto'});
                        },
                        success: function(json) {
                            var ret = json['ret'];
                            if (ret == 200) {
                                window.location.href = "/";
                            } else {
                                isReg = false;
                                var nObj;
                                switch (ret) {
                                    case -1:
                                    case -5:
                                        nObj = mobileObj;
                                        break;
                                   /* case -2:
                                        nObj = codeObj;
                                        break;*/
                                    case -3:
                                    /*case -6:
                                        nObj = smscodeObj;
                                        break;*/
                                    case -4:
                                        nObj = passwordObj;
                                        break;
                                    default:
                                        nObj = mobileObj;
                                        break;
                                }
                                registerBoxMsg(nObj, json['msg']);
                            }
                        },
                        error: function(reg) {
                            console.log(reg);
                        }
                    });
                }else{
                    isReg=false;
                }
            }
        });

        autoSubmit('.registerL', registerSubmitOBJ); // 回车键提交注册
    });

</script>
<div class="login-footer">
    <div class="copyright_links">
        <a target="_blank" href="/register-info.html">
            注册协议
        </a>
        <span class="spacer"></span>
        <a class="p-kefu" onclick="openZoosUrl('chatwin');">
            联系客服
        </a>

        <span class="spacer"></span>
        <a target="_blank" title="全部分类" href="/class.html">
            全部分类
        </a>
        <span class="spacer"></span>
        <a target="_blank" title="站点地图" href="/map.html">
            站点地图
        </a>
        <span class="spacer"></span>
        <a target="_blank" title="APP下载" href="/download">
            APP下载
        </a>
    </div>
    <p class="copyright">版权所有  copyright 2017-2022
        <a href="https://www.huju168.com/" title="虎居网上商城">四川蓝海农夫数字科技有限公司</a>   (400028521)
    </p>
    <p class="copyright">
        <a class="beian" rel="nofollow" target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=51019002001684">
            <img th:src="@{/picture/58c94020eabf4431b9284ef49fd6bfa2.gif}" />&nbsp;
            <span>川公网安备 51019002001684号</span>
        </a>
        <span class="spacer"></span>
        <a target="_blank" href="http://www.miibeian.gov.cn" rel="nofollow">网站备案/许可证号：蜀ICP备18008634号-1</a>
        <span class="spacer"></span>
        <a target="_blank" href="/edi.html" rel="nofollow">经营许可证：川B2-20180361</a>
    </p>
</div>
<script th:src="@{/js/checkfunction.js}" 0="app\assets\AppAsset"></script>
<script th:src="@{/js/smscode.js}" 0="app\assets\AppAsset"></script>

<!-- 百度统计  -->
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?ae46b3aea45eeb954b1d527fc7792211";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

</body>
</html>
